<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //获取指定值出现的位置 
    //indexOf()方法
    //数组元素排序 sort() 默认从小到大 只针对0-9的数字 arr.sort()
    //颠倒数组中元素的顺序
    //通过reverse arr.reverse()对数组进行反序处理
    var arr =[3,2,5,1,9];
    arr1 = arr.sort();
    console.log(arr1);
    //输出1 2 3 5 9
    var arr2 =[3,2,15,1,9];
    arr3 = arr2.sort();
    console.log(arr3);
    //输出 1 15 2 3 9
    
    var arr4=arr2.sort(function(a,b){
        return a-b;
    });
    console.log(arr4);
    //输出1 2 3 9 15

    var arr5 = arr1.reverse();
    console.log(arr5);
    //输出9 5 3 2 1
</script>
</html>